<div class="alert-title">添加IP黑名单</div>

<input type="text" class="am-form-field ip-add" value="" 
    placeholder="请输入要禁止的IP地址">
<div class="ipclue red">来自本IP的用户，将被禁止登录</div>
<input type="text" class="am-form-field ip-memo" value="" 
    placeholder="备注信息">

<ul class="am-avg-sm-2 buttons">
    <li><button class="btn-save common_button">保存</button></li>
    <li><button class="close common_button">关闭</button></li>
</ul>
<style type="text/css">
    ul.buttons {
        margin-top: 20px;
    }
    ul.buttons li {
        text-align: center;
    }
    ul.users li {
        text-align: center;
        line-height: 36px;
    }
    .ipclue {
        line-height: 30px;
    }
</style>

<script>
    (function() {
        var type = $(".f9 select").val();
        if (type == 'sign-in') {
            $(".ipclue").html("来自本IP的用户，将被禁止登录")
        }
        else {
            $(".ipclue").html("来自本IP的用户，将被禁止注册")
        }

        $(".buttons .close").click(function() {
            $("#add_ip").remove();
        });

        $("ul.buttons .btn-save").click(function() {
            var ip = $("input.ip-add").val();
            if (ip == '') return;
            startLoading();
            var memo = {
                time: new Date().Format("yyyy-MM-dd HH:mm:ss"),
                oper: context.user.user.mobile,
                memo: $(".ip-memo").val().trim(),
            };
            CMD.blacklist_save(type, ip, JSON.stringify(memo), function() {
                stopLoading();
                $("#add_ip").remove();
                _f();
            })
        });
    })();
</script>
